<?php
require("config.php");

$aetime = date("Y-m-d", mktime(0,0,0, date("m"), date("d")+3, date("Y")));
$remindq = "select id from med_aevening where date='$aetime'";
$remindr = myQuery($remindq);
//echo $remindr[0][0];
//if (!empty($remindr[0][0])) {

for ($g=0; $g<count($remindr);$g++) {
$id = $remindr[$g][0];
$Query = "SELECT 
id,
code,
first_name,
last_name,
position,
company,
c_address,
p_address,
email,
o_phone,
m_phone,
h_phone,
aid,
date,
status
FROM med_aenroll WHERE aid='$id' and status='Registered'";
//echo $Query;
$r=myQuery($Query);

for ($k=0; $k<count($r);$k++) {

$code=$r[$k][1];
$first_name=$r[$k][2];
$last_name=$r[$k][3];
$position=$r[$k][4];
$company=$r[$k][5];
$c_address=$r[$k][6];
$p_address=$r[$k][7];
$email=$r[$k][8];
$o_phone=$r[$k][9];
$m_phone=$r[$k][10];
$h_phone=$r[$k][11];
$aid=$r[$k][12];
$date=$r[$k][13];
$status=$r[$k][14];

$to = $email;

$Query = "select date, time, presented, venue, name from med_aevening where id='$aid'";
$r2 = myQuery($Query);
$adate = $r2[0][0];
$atime = $r2[0][1];
$presented = $r2[0][2];
$venue = $r2[0][3];
$name = $r2[0][4];

/*
$headers = "From: Acuity World <info@acuityworld.com>\r\n";
$headers .= "X-Sender: <info@acuityworld.com>\r\n";
$headers .= "Return-Path: <info@acuityworld.com>\r\n";
$subject = "Reminder to our upcoming Acuity Evening\r";

$message = "";

$message .= "Dear $first_name,\n\n";

$message .= "This email is to remind you of attending the following Acuity Evening.\n\n";

$message .= "Date: $adate\n";
$message .= "Time: $atime\n";
$message .= "Acuity Evening: $presented\n";
$message .= "Venue: $venue\n";
$message .= "Description: $name\n\n";

$message .= "Your Personal Information:\n";
$message .= "Date of Sign Up: $date\n\n";

$message .= "First Name: $first_name\n";
$message .= "Last Name: $last_name\n";
$message .= "Position: $position\n";
$message .= "Company: $company\n";
$message .= "Company Address: $c_address\n";
$message .= "Private Address: $p_address\n";
$message .= "Email: $email\n";
$message .= "Office Telephone: no.: $o_phone\n";
$message .= "Mobile telephone no.: $m_phone\n";
$message .= "Home telephone no.: $h_phone\n\n\n";


$message .= "Please print and bring this confirmation with you for the registration.  We are looking forwards to see you.\n\n";

$message .= "Best regards,\n\n\n";


$message .= "Acuity World\n";
$message .= "Making Leadership Personal with PLP in Denmark & HK\n";
$message .= "www.acuityworld.com\n";
$message .= "Tel: +45 4448 6969\n";
mail($to, $subject, $message, $headers);

*/

$from_name = "Acuity World";
$from_email = "info@acuityworld.com";
$to_name = $first_name;
$to_email = $email;

$subject = "Reminder to our upcoming Acuity Evening";

$content1 = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Acuity World</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body bgcolor='#FFFFFF'>
<table width='600' border='0' cellspacing='0' cellpadding='1'>
  <tr>
    <td align='right'><table width='180' border='0' cellpadding='1' cellspacing='0'>
  <tr>
    <td bgcolor='#000000'><table width='100%' border='0' cellpadding='1' cellspacing='0' bgcolor='#FFFFFF'>
        <tr>
                <td align='center'><font size='3' face='Verdana, Arial, Helvetica, sans-serif'><strong>Acuity World</strong></font></td>
        </tr>
      </table></td>
  </tr>
</table></td>
  </tr>
</table>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Dear $first_name,</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>This email is to remind you of attending the following Acuity Evening.</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Date: 
  $adate
  <br>
  Time: 
  $atime
  <br>
  Acuity Evening: 
  $presented
  <br>
  Venue: 
  $venue
  <br>
  Description: 
  $name
</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Your Personal Information:<br>
  Date of Sign Up: 
    $date
</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>First Name: 
  $first_name
  <br>
  Last Name: 
  $last_name
  <br>
  Position: 
  $position
  <br>
  Company: 
  $company
  <br>
  Company Address: 
  $c_address
  <br>
Private Address:
$p_address
<br>
  Email: 
  $email
  <br>
  Office Telephone: no.: 
  $o_phone
  <br>
  Mobile telephone no.: 
  $m_phone
  <br>
  Home telephone no.: 
  $h_phone
  <br>
</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Please print and bring this confirmation with you for the registration.  We are looking forwards to see you.</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Best regards,<br>
</font></p>
<p><font size='2' face='Arial, Helvetica, sans-serif'>Acuity World<br>
  Making Leadership Personal with PLP in Denmark &amp; HK www.acuityworld.com<br>
  Tel: +45 4448 6969</font></p>
<p>&nbsp; </p>
</body>
</html>
";
sendhtmlmail($from_name,$from_email,$to_name,$to_email,$subject,$content1);
//echo $to_email . "<br>" . $content1 . "<br>";
}

}


exit();




?>